1. Field of the Invention
This invention relates to operating a computer, and more particularly to generating a knowledge base for an expert system by a computer.
2. Description of Related Art
Rule-based expert systems represent an expert's knowledge in the form of rules. Each rule is a logical relationship between statements. FIG. 1 shows the rules of a fairly simple knowledge base that contains the knowledge as to how to troubleshoot a factory system. The knowledge base can be summarized as follows. If the system is not working, check whether the power is on. If the power is off, turn on the power switch. If the system is still not working, check the wiring. If the wiring is defective, replace it. If the system is still not working, call the repairman to fix it.
In order to generate the knowledge base, the user represents the knowledge in the form of rules such as the rules in FIG. 1, and supplies the rules to a computer A computer program then generates the knowledge base.
As is illustrated by FIG. 1, the rules of even a simple knowledge base are confusing, and writing such rules is a difficult and error-prone task.
Various techniques have been developed to assist the user in writing rules. One technique is to build a graphical representation of the knowledge base before writing the rules. Graphical representations include flowcharts and logic trees. The nodes of a flowchart or a logic tree represent statements of the knowledge base. Different kinds of statements are represented by nodes of different shapes. FIGS. 7A-7G show shows the node shapes in one flowchart technique. Seven different shapes are used as follows:
FIG. 7A is a Question symbol which represents a STATEMENT that waits for input value. The input value can be TRUE, FALSE or UNKNOWN. Examples of commands attached to the STATEMENT are Read.sub.-- stmt.sub.-- state, Get.sub.-- plc.sub.-- state and Get.sub.-- timer.sub.-- state.
FIG. 7B is an Action symbol which represents a STATEMENT that is similar to the one above except that the triggered STATEMENT is always set to TRUE once the input is read, regardless of its value. A command that is attached to this kind of STATEMENT is Read.sub.-- confirmation.
FIG. 7C is a Message symbol which represents a STATEMENT that sends out messages. Send.sub.-- text is an example of a command attached to this kind of STATEMENT.
FIG. 7D is a Dummy symbol which represents a STATEMENT that has no commands attached to it.
FIG. 7E is a K.B. jump symbol which represents a STATEMENT which, when triggered, will interrupt the current interface loop by executing another named knowledge base. The command attached to the STATEMENT is Run.sub.-- kb.
FIG. 7F is a Restart symbol which represents the STATEMENT which when triggered, will restart the whole knowledge base. The command attached is Restart.sub.-- kb.
FIG. 7G is an Exit symbol which represents a STATEMENT which when triggered, will terminate the execution of the current knowledge base. The command attached is Quit.sub.-- kb. The user builds the graphical representation, and then writes the rules while having the graphical representation before him. The graphical representation is easier to construct than the rules, and it guides the user in writing the rules.
While the use of graphical representations simplifies rule writing, the rule writing remains a difficult, error-prone task, especially for large knowledge bases. Further, for a large knowledge base, a graphical representation can be complex and thus difficult to build and use.
Thus it is desirable to provide a system that simplifies generation of knowledge bases. In particular, it is desirable to simplify rule generation. It is desirable to provide visual aids such as flowcharts that are less confusing and consequently easier to use.
It is also desirable to provide a system that simulates knowledge base execution and provides the simulation results so that they are easy to understand. Such a system could facilitate debugging of knowledge bases and training inexperienced personnel